Skip to content

feat: add Tron chain definitions for currency package#1688

Merged
rodrigopavezi merged 1 commit intomasterfrom
feat/tron-currency
Feb 12, 2026
Merged

feat: add Tron chain definitions for currency package#1688
rodrigopavezi merged 1 commit intomasterfrom
feat/tron-currency

Conversation

@rodrigopavezi
Copy link
Member

@rodrigopavezi rodrigopavezi commented Jan 26, 2026

Description of the changes

Added support for Tron blockchain and its Nile testnet:

  • Created new Tron chain configuration with USDT and USDC token definitions
  • Added Nile testnet configuration for Tron
  • Implemented TronChains class for handling Tron-specific chain operations
  • Updated type definitions to include Tron chains in the supported VM chains
  • Added Tron chains to the exports for use throughout the application

Closes RequestNetwork/private-issues#223
Closes RequestNetwork/private-issues#224

Summary by CodeRabbit

  • New Features
    • Added support for Nile testnet network configuration
    • Added support for Tron network with testnet toggle capability
    • Introduced token catalog for Tron network featuring USDT-TRC20 and USDC tokens with metadata

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

Adds Tron network configuration files to the SDK's currency module. Introduces the Nile testnet configuration with chainId and testnet flag, alongside Tron mainnet configuration with testnet flag and TRC20 token currency mappings (USDT-TRC20 and USDC).

Changes

Cohort / File(s) Summary
Tron Network Configuration
packages/currency/src/chains/declarative/data/nile.ts, packages/currency/src/chains/declarative/data/tron.ts
Adds Nile testnet configuration with chainId and empty currencies object placeholder. Adds Tron mainnet configuration with testnet flag set to false and currencies map containing USDT-TRC20 and USDC token metadata (name, symbol, decimals).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/tron-currency

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 26, 2026

Greptile Overview

Greptile Summary

Added comprehensive support for Tron blockchain to the currency package, enabling the system to handle Tron mainnet and Nile testnet chains.

  • Created TronChains class following the established pattern from EvmChains and NearChains, extending ChainsAbstract with Tron-specific chain operations
  • Defined Tron mainnet with USDT (TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t) and USDC (TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8) TRC20 token addresses
  • Created Nile testnet configuration as a placeholder for test token definitions
  • Added TronChainName type definition and included Tron chains in VMChainName to indicate that payment proxy contracts can be deployed on Tron
  • Properly integrated both Tron chains into the declarative chains system and exported TronChains for use throughout the application
  • Fixed typo in comment ("Virtual machine" instead of "Virtual machin")

The implementation follows the existing architectural patterns and is consistent with how other blockchain networks are integrated into the system.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation follows established patterns from existing chain integrations (EVM, NEAR), uses consistent type definitions, and adds new functionality without modifying existing code. All changes are purely additive and well-structured.
  • No files require special attention

Important Files Changed

Filename Overview
packages/currency/src/chains/declarative/data/tron.ts Added Tron mainnet configuration with USDT and USDC token definitions
packages/currency/src/chains/tron/TronChains.ts Created TronChains class extending ChainsAbstract for Tron chain operations
packages/types/src/currency-types.ts Added TronChainName type and included it in VMChainName, fixed typo in comment

Sequence Diagram

sequenceDiagram
    participant App as Application
    participant TronChains as TronChains
    participant ChainsAbstract as ChainsAbstract
    participant TronDef as Tron/Nile Definitions
    participant Types as Currency Types

    App->>Types: Import TronChainName type
    App->>TronChains: Import TronChains instance
    TronChains->>TronDef: Load chain definitions (tron, nile)
    TronChains->>ChainsAbstract: Initialize with chains & CURRENCY.ETH
    ChainsAbstract->>ChainsAbstract: Register chain names
    ChainsAbstract->>ChainsAbstract: Attempt to add native currencies
    Note over ChainsAbstract: No native TRX currencies defined,<br/>so none are added
    App->>TronChains: isChainSupported('tron')
    TronChains-->>App: true
    App->>TronChains: getChainId('tron')
    TronChains->>TronDef: Access tron.chainId
    TronDef-->>TronChains: 'tron'
    TronChains-->>App: 'tron'
    App->>TronChains: Access currencies for tron
    TronChains->>TronDef: Access tron.currencies
    TronDef-->>App: {USDT, USDC definitions}
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@rodrigopavezi rodrigopavezi changed the base branch from feat/tron-smart-contracts to graphite-base/1688 January 27, 2026 01:48
@rodrigopavezi rodrigopavezi changed the base branch from graphite-base/1688 to feat/tron-smart-contracts January 27, 2026 01:49
@rodrigopavezi rodrigopavezi force-pushed the feat/tron-currency branch 13 times, most recently from 62d10a1 to 2496888 Compare January 27, 2026 09:29
MantisClone

This comment was marked as duplicate.

Copy link
Member

@MantisClone MantisClone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me so far.

Reviewed with Claude Code Opus 4.5

@MantisClone MantisClone self-requested a review February 10, 2026 15:10
Copy link
Member

@MantisClone MantisClone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — clean chain definitions. The temporary placement in declarative chains is properly resolved by #1687 which moves Tron to its own TronChains class.

@rodrigopavezi rodrigopavezi force-pushed the feat/tron-currency branch 3 times, most recently from ba62981 to a2cb3db Compare February 11, 2026 14:39
@rodrigopavezi rodrigopavezi force-pushed the feat/tron-smart-contracts branch from 988cd5c to 2374a54 Compare February 11, 2026 14:39
@rodrigopavezi rodrigopavezi force-pushed the feat/tron-smart-contracts branch from 2374a54 to fc2b3fd Compare February 11, 2026 14:48
@rodrigopavezi rodrigopavezi force-pushed the feat/tron-currency branch 2 times, most recently from 16a0c76 to 709f9ba Compare February 11, 2026 14:53
@rodrigopavezi rodrigopavezi force-pushed the feat/tron-smart-contracts branch from fc2b3fd to 21c3cc0 Compare February 11, 2026 14:53
@rodrigopavezi rodrigopavezi force-pushed the feat/tron-smart-contracts branch 2 times, most recently from 1ead8ab to fb04b23 Compare February 11, 2026 16:42
Copy link
Member Author

rodrigopavezi commented Feb 12, 2026

Merge activity

  • Feb 12, 1:06 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Feb 12, 1:11 PM UTC: Graphite rebased this pull request as part of a merge.
  • Feb 12, 1:11 PM UTC: @rodrigopavezi merged this pull request with Graphite.

@rodrigopavezi rodrigopavezi changed the base branch from feat/tron-smart-contracts to graphite-base/1688 February 12, 2026 13:08
@rodrigopavezi rodrigopavezi changed the base branch from graphite-base/1688 to master February 12, 2026 13:09
- Add Tron mainnet and Nile testnet chain configurations
- Add TronChains types and exports
- Update currency-types with Tron chain support
@rodrigopavezi rodrigopavezi merged commit c7b682f into master Feb 12, 2026
1 of 4 checks passed
@rodrigopavezi rodrigopavezi deleted the feat/tron-currency branch February 12, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants